package org.will.test.domain.builder;

import com.alibaba.fastjson.JSONObject;
import org.will.test.domain.PayOutMessage;

/**
 * Created by jsycwangwei on 2017/7/9.
 */
public class JsonBuilder extends BaseBuilder<TextBuilder,PayOutMessage>{
    JSONObject json = null;

    public JsonBuilder(JSONObject json){
        this.json= json;
    }

    public JSONObject getJson(){
        return json;
    }

    public JsonBuilder content(String key, Object content){
        this.json.put(key, content);
        return this;
    }

    @Override
    public PayOutMessage build() {
        PayJsonOutMessage message = new PayJsonOutMessage();
        setCommon(message);
        message.setContent(json.toJSONString());
        return message;
    }
}
